/**
 * 
 */
package com.yullage.ann.common;

import java.util.List;
import java.util.Random;

/**
 * @author Yu-chun Huang
 * 
 */
public class Util {

	private static final Random rand = new Random();

	public static double getRandom() {
		return rand.nextDouble() * 2 - 1; // [-1;1[
	}

	public static double calcSquaredEuclideanDistance(List<Double> vector1, List<Double> vector2) {
		double output = 0;
		int dimension = vector1.size();

		for (int i = 0; i < dimension; i++) {
			output += Math.pow(vector1.get(i) - vector2.get(i), 2);
		}

		return output;
	}
}
